"""
map()映射
    字典：{无序的键值对组合：key--->value}

reduce()规约
map()python内置函数
    map(函数,Iterable)
    map将可迭代的对象中的每一个元素，都应用到函数上。返回一个新的可迭代对象

Iterable：可迭代的对象
Iterator：迭代器
"""

"""
  map(func, *iterables) --> map object

  Make an iterator that computes the function using arguments from
  each of the iterables.  Stops when the shortest iterable is exhausted.
  """

list1 = [x for x in range(1, 10)]
list2 = [1, 2, 3, 4, 5, 6]
m = map(lambda x: x ** 2, list2)
print(m)
for i in m:
    print(i)

# from collections import Iterator
# print(isinstance(m, Iterator))

list1 = [x for x in range(1, 10)]
list2 = [x for x in range(11, 29)]

m1 = map(lambda x, y: x + y, list1, list2)

for i in m1:
    print(i, end=' ')
# map(func, *iterables)  iterables 的个数  和 func 的参数的个数是相同
# TypeError: <lambda>() takes 1 positional argument but 2 were given
